package com.bw.shopping.mvvm.model;

import com.bw.mvvm.entity.BaseEntity;
import com.bw.mvvm.mvvm.model.BaseModel;
import com.bw.mvvm.network.load.HttpEnum;
import com.bw.mvvm.network.load.HttpFactory;

import java.util.HashMap;

import io.reactivex.Observable;
import okhttp3.RequestBody;

public class ShoppingModel extends BaseModel {
    
    public Observable<BaseEntity> requestDeta(HashMap<String,Object> map){

        return changeFunc(HttpFactory.create(HttpEnum.TokenSign)
                .getRetrofit()
                .create(Api.class)
                .requestCarList(createBody(map)));
    }

    public Observable<BaseEntity> submitCart(RequestBody body){
        return changeFunc(HttpFactory.create(HttpEnum.Token).getRetrofit()
                .create(Api.class).submitCart(body));
    }

    public Observable<BaseEntity> delCart(RequestBody body){
        return changeFunc(HttpFactory.create(HttpEnum.Token).getRetrofit()
                .create(Api.class).requestDelShop(body));
    }
    public Observable<BaseEntity> requestPay(RequestBody body){
        return changeFunc(HttpFactory.create(HttpEnum.TokenSign).getRetrofit()
                .create(Api.class).requestOrderPay(body));
    }
}
